import Book.Booklist;
import user.AdminUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:${USER}
 * Date:${YEAR}-${MONTH}-${DAY}
 * Time:${TIME}
 */
public class Main {

    public static User login(){
        Scanner san = new Scanner(System.in);
        System.out.println("请输入你的姓名");
        String name = san.nextLine();
        System.out.println("请输入你的身份: 1-管理员  2-普通用户");
        int choice = san.nextInt();
        if(choice==1){
            AdminUser adminUser = new AdminUser(name);
           return adminUser;
        }else{
            NormalUser normalUser = new NormalUser(name);
            return normalUser;
        }

    }
    public static void main(String[] args) {
        Booklist booklist = new Booklist();

        User user = login();
        int choice = user.menu();
        while(choice!=0){
            user.Doperation(choice,booklist);

            
            choice=user.menu();

        }
        System.out.println("****成功退出系统****");
    }
}